package com.atguigu.day05.test;

import java.util.Scanner;

/**
 * @version 1.0
 * @Author 马冰
 * @Date 2024/11/4 12:53
 * @注释 键盘输入五个成绩存入数组,并打印总分和平均分
 */
public class ArrayTest03 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入成绩:");
        double[] arr = new double[5];
        for (int i = 0; i < 5; i++) {
            arr[i] = sc.nextDouble();
        }
        double sum = 0;
        double average = 0;
        for (int i = 0; i < 5; i++) {
            sum += arr[i];
        }
        average = sum / 5;
        System.out.println("总和:" + sum);
        System.out.println("平均分:" + average);
    }
}
